<template>
    <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal">
        <el-menu-item index="1">
            <img class="head_img"
                src="https://tse2-mm.cn.bing.net/th/id/OIP-C._egkLh7uGqEsqArNqmZBrAHaHa?w=167&h=180&c=7&r=0&o=5&dpr=1.1&pid=1.7">
        </el-menu-item>
        <el-menu-item index="1" >网盘</el-menu-item>
        <el-menu-item index="2">分享</el-menu-item>
        <el-menu-item index="3" @click="logout">退出登录</el-menu-item>
    </el-menu>
</template>


<script>
export default {
    name: "headerNav",
    data() {
        return {
            activeIndex: 1
        }
    },
    methods: {
        async logout() {
            await this.$store.dispatch('user/logout')
            this.$router.push(`/login`)
        }
    }

}
</script>

<style>
.head_img {
    width: 40px;
}
</style>